<template>
    <div style="height: 50px;width: 100%;border-bottom: 1px solid #e4e4e4;line-height: 50px;display: flex;position: relative">
        <span style="font-weight: 600;font-size: 16px;color: #1E90FF;margin-left: 30px">后台管理</span>
        <div style="right:60px;position: absolute">
            <el-dropdown @command="a">
  <span class="el-dropdown-link">
    金莎<i class="el-icon-arrow-down el-icon--right"></i>
  </span>
                <el-dropdown-menu slot="dropdown"
                                  split-button=true
                >
                    <el-dropdown-item
                    >
                        个人中心
                    </el-dropdown-item>
                    <el-dropdown-item command="logout">退出登录</el-dropdown-item>
                </el-dropdown-menu>
            </el-dropdown>
        </div>
    </div>
</template>

<script>
    export default {
        name: "Header"
        , methods: {
            a(command) {
                console.log(command)
                if (command === 'logout') {
                    this.clearToken()
                }
            },
            clearToken() {
                console.log('111')
                localStorage.removeItem('token')
                this.$router.push('/login')
            }
        }
    }
</script>

<style scoped>
    .el-dropdown-link {
        cursor: pointer;
        color: #409EFF;
    }

    .el-icon-arrow-down {
        font-size: 12px;
    }
</style>